Jan-Philipp Kolb
Sun Aug 30 12:35:29 2015
## Warning: package 'knitr' was built under R version 3.2.2
Install package from github
library(devtools)
devtools::install_github("Japhilko/GeoData/geosmdata2")
Download information using the Overpass API
library(geosmdata2)
place <- "Hamburg"
object <- "bakery"
xml_obj <- get_osm_nodes(object,place)
info <- extract_info_op(xml_obj,"bakery")
| addr.city | name | lat | lon | |
|---|---|---|---|---|
| 26564261 | Hamburg | Bäckerei Becker | 53.47363 | 9.876336 |
| 26564277 | Hamburg | Hilert | 53.47830 | 9.888341 |
| 31205227 | NA | Eisenschmidt | 53.45951 | 9.977062 |
| 33317605 | Hamburg | Coffee Lounge | 53.46112 | 9.978735 |
| 188596229 | NA | NA | 53.50876 | 10.185844 |
| 249321304 | NA | Nehberg | 53.59220 | 10.076242 |
| 253202239 | Hamburg | Konditorei Nehberg | 53.58763 | 10.086954 |
| 253413763 | Hamburg | Cafe Bistro ATW | 53.58799 | 10.070154 |
nr_mf <- apply(info,2,function(x)sum(!is.na(x)))
nr_mf
## addr.city addr.country addr.housenumber
## 119 92 133
## addr.postcode addr.street name
## 131 145 467
## shop wheelchair created_by
## 518 285 3
## opening_hours phone amenity
## 117 55 17
## source website wheelchair.description
## 12 41 8
## building wifi operator
## 1 1 20
## cuisine dog fax
## 3 1 3
## food diet.vegan description
## 2 1 3
## addr.suburb brand floor
## 1 4 1
## layer craft toilets.wheelchair
## 7 1 2
## alt_name email lastcheck
## 1 1 4
## note start_date description.de
## 4 2 1
## image smoking addr.housename
## 1 1 4
## level indoor atm
## 5 2 1
## internet_access contact.email contact.phone
## 1 2 1
## contact.website organic lat
## 1 1 518
## lon
## 518
library(ggmap)
## Warning: package 'ggmap' was built under R version 3.2.2
## Warning: package 'ggplot2' was built under R version 3.2.2
Imap <- qmap(location = place, zoom = 11, maptype="toner",source="stamen")
Imap
The example is taken from here
Imap + geom_density2d(data = info, aes(x = lon, y = lat),lwd=1.5)
Imap + stat_density2d(data = info, aes(x = lon, y = lat, fill = ..level..,
alpha = ..level..), bins = 80,
geom = 'polygon')
place <- "Kaiserslautern"
obj <- "cycleway"
xml2 <- get_osm_ways(object2=obj,place)
info_cw <- extract_position_op(OSM.Data=xml2,value="cycleway")
##
|
| | 0%
|
|= | 1%
|
|= | 2%
|
|== | 3%
|
|=== | 4%
|
|=== | 5%
|
|==== | 6%
|
|==== | 7%
|
|===== | 7%
|
|===== | 8%
|
|====== | 9%
|
|====== | 10%
|
|======= | 10%
|
|======= | 11%
|
|======== | 12%
|
|======== | 13%
|
|========= | 13%
|
|========= | 14%
|
|========== | 15%
|
|========== | 16%
|
|=========== | 16%
|
|=========== | 17%
|
|============ | 18%
|
|============ | 19%
|
|============= | 20%
|
|============= | 21%
|
|============== | 21%
|
|============== | 22%
|
|=============== | 23%
|
|=============== | 24%
|
|================ | 24%
|
|================ | 25%
|
|================= | 26%
|
|================= | 27%
|
|================== | 27%
|
|================== | 28%
|
|=================== | 29%
|
|=================== | 30%
|
|==================== | 30%
|
|==================== | 31%
|
|===================== | 32%
|
|===================== | 33%
|
|====================== | 33%
|
|====================== | 34%
|
|======================= | 35%
|
|======================= | 36%
|
|======================== | 36%
|
|======================== | 37%
|
|======================== | 38%
|
|========================= | 38%
|
|========================= | 39%
|
|========================== | 39%
|
|========================== | 40%
|
|========================== | 41%
|
|=========================== | 41%
|
|=========================== | 42%
|
|============================ | 42%
|
|============================ | 43%
|
|============================ | 44%
|
|============================= | 44%
|
|============================= | 45%
|
|============================== | 45%
|
|============================== | 46%
|
|============================== | 47%
|
|=============================== | 47%
|
|=============================== | 48%
|
|================================ | 48%
|
|================================ | 49%
|
|================================ | 50%
|
|================================= | 50%
|
|================================= | 51%
|
|================================= | 52%
|
|================================== | 52%
|
|================================== | 53%
|
|=================================== | 53%
|
|=================================== | 54%
|
|=================================== | 55%
|
|==================================== | 55%
|
|==================================== | 56%
|
|===================================== | 56%
|
|===================================== | 57%
|
|===================================== | 58%
|
|====================================== | 58%
|
|====================================== | 59%
|
|======================================= | 59%
|
|======================================= | 60%
|
|======================================= | 61%
|
|======================================== | 61%
|
|======================================== | 62%
|
|========================================= | 62%
|
|========================================= | 63%
|
|========================================= | 64%
|
|========================================== | 64%
|
|========================================== | 65%
|
|=========================================== | 66%
|
|=========================================== | 67%
|
|============================================ | 67%
|
|============================================ | 68%
|
|============================================= | 69%
|
|============================================= | 70%
|
|============================================== | 70%
|
|============================================== | 71%
|
|=============================================== | 72%
|
|=============================================== | 73%
|
|================================================ | 73%
|
|================================================ | 74%
|
|================================================= | 75%
|
|================================================= | 76%
|
|================================================== | 76%
|
|================================================== | 77%
|
|=================================================== | 78%
|
|=================================================== | 79%
|
|==================================================== | 79%
|
|==================================================== | 80%
|
|===================================================== | 81%
|
|===================================================== | 82%
|
|====================================================== | 83%
|
|====================================================== | 84%
|
|======================================================= | 84%
|
|======================================================= | 85%
|
|======================================================== | 86%
|
|======================================================== | 87%
|
|========================================================= | 87%
|
|========================================================= | 88%
|
|========================================================== | 89%
|
|========================================================== | 90%
|
|=========================================================== | 90%
|
|=========================================================== | 91%
|
|============================================================ | 92%
|
|============================================================ | 93%
|
|============================================================= | 93%
|
|============================================================= | 94%
|
|============================================================== | 95%
|
|============================================================== | 96%
|
|=============================================================== | 97%
|
|================================================================ | 98%
|
|================================================================ | 99%
|
|=================================================================| 100%
info_cw$lat <- as.numeric(as.character(info_cw$lat))
info_cw$lon <- as.numeric(as.character(info_cw$lon))
Imap12 <- qmap(location = place, zoom = 12, maptype="toner",source="stamen")
Imap12
Imap12 + geom_point(aes(x=lon,y=lat),data=info_cw,col="red")
p <- ggplot(info_cw,aes(x=lon,y=lat,group=id),colour = rgb(1,0,0),size = 2)
p + geom_line()